package com.company.笔试.合并两个有序数组;



/**
 * @ClassName Solution
 * @Description TODO
 * @Author 11
 * @Date 2021/6/7 19:29
 * @Version 1.0
 */
public class Solution {
    public void merge(int A[], int m, int B[], int n) {
        int p1 = m-1;
        int p2=n-1;
        int index = m+n-1;
        while (p1>=0&&p2>=0){
            A[index--] = A[p1]>B[p2]?A[p1--]:B[p2--];
        }
        while (p2>=0){
            A[index--]=B[p2--];
        }
    }
}

